package cn.com.joyplus.wechat.model;

import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

import java.io.Serializable;
import java.math.BigDecimal;


/**
 * Created by 王灏川(wangrs@qq.com) on 2017/8/11 0011.
 */
public class WechatEvent extends  BaseMessage implements Serializable {

    private static final long serialVersionUID = -8794682727260719657L;

    private String strVal;

    @JacksonXmlProperty(localName = "Event")
    private String event="Message";

    @JacksonXmlProperty(localName = "EventKey")
    private String eventKey;


    //微信返回的数据结构不规范，MsgId和MsgID都有可能出现，所以下面对这两个节点都定义了
    @JacksonXmlProperty(localName = "MsgID")
    private String msgID;
    @JacksonXmlProperty(localName = "MsgId")
    private String msgId;

    @JacksonXmlProperty(localName = "MenuId")
    private String menuId;

    @JacksonXmlProperty(localName = "Encrypt")
    private String encrypt;

    @JacksonXmlProperty(localName = "Content")
    private String content;

    @JacksonXmlProperty(localName = "PicUrl")
    private String picUrl;

    @JacksonXmlProperty(localName = "MediaId")
    private  String mediaId;

    @JacksonXmlProperty(localName = "Format")
    private String format;

    @JacksonXmlProperty(localName = "Recognition")
    private String recognition;

    private String status;



    private String ticket;
    private BigDecimal latitude;
    private BigDecimal longitude;
    private BigDecimal precision;



    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public String getEventKey() {
        return eventKey;
    }

    public void setEventKey(String eventKey) {
        this.eventKey = eventKey;
    }

    public String getMenuId() {
        return menuId;
    }

    public void setMenuId(String menuId) {
        this.menuId = menuId;
    }

    public String getTicket() {
        return ticket;
    }

    public void setTicket(String ticket) {
        this.ticket = ticket;
    }

    public BigDecimal getLatitude() {
        return latitude;
    }

    public void setLatitude(BigDecimal latitude) {
        this.latitude = latitude;
    }

    public BigDecimal getLongitude() {
        return longitude;
    }

    public void setLongitude(BigDecimal longitude) {
        this.longitude = longitude;
    }

    public BigDecimal getPrecision() {
        return precision;
    }

    public void setPrecision(BigDecimal precision) {
        this.precision = precision;
    }

    public String getMsgId() {
        return null == msgId ? msgID : msgId;
    }

    public void setMsgId(String msgId) {
        this.msgId = msgId;
    }

    public void setMsgID(String msgID) {
        this.msgID = msgID;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public String getEncrypt() {
        return encrypt;
    }

    public void setEncrypt(String encrypt) {
        this.encrypt = encrypt;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getMediaId() {
        return mediaId;
    }

    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }

    public void setStrVal(String strVal) {
        this.strVal = strVal;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        WechatEvent event = (WechatEvent) o;

        return strVal.equals(event.strVal);
    }

    @Override
    public int hashCode() {
        return strVal.hashCode();
    }
}
